<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var find = function (k) {
      if (k == 0)
        return 0
      let f = 1, f1 = 1
      while (f1 <= k) {
        const tmp = f
        f = f1
        f1 += tmp
      }
      return 1 + find(k - f)
    };
    console.log(find(k = 7))
  </script>
</body>

</html>